<?php
namespace app\admin\controller;
use think\Controller;
use think\Session;
use app\common\controller\Login;
use think\Request;
use think\Db;
class Users extends Login
{
	public function index()
	{

		$agent_id = session::get('agent_id');

		$data = db('users')->where('agents_id',$agent_id)->paginate(5);

		$page = $data->render();
		//var_dump($data->0->id);die;
		$this->assign('page',$page);

		$this->assign('data',$data);

		return $this->fetch();
	}

	public function delete($id)
	{
		$static = db('users')->delete($id);

		if ($static) {
			return $this->redirect('admin/users/index');
		}else{
			return $this->error('发生未知错误，请重试！');
		}
	}


}
